<?php
class WObject{
   use Design;
}
trait Design{
    static public function Instant(...$data){
        static $instant = [];
        $get_called_class = get_called_class();
        if($instant[$get_called_class]) return $instant;
        $instant[$get_called_class] = new static(...$data);
        return $instant[$get_called_class];
    }
}
class A extends WObject{
    public function go(){
        echo "AAAAA";
    }
}
class B extends WObject{
    public function go(){
        echo "BBBBBB";
    }
}
A::Instant()->go();
echo "\n";
B::Instant()->go();